package com.lzj.weather02;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.mapreduce.Partitioner;

public class WeatherPartitioner extends Partitioner<Weather, IntWritable> {

    @Override
    public int getPartition(Weather key, IntWritable value, int numPartitions) {
        //使用区划编码和年和月累加，然后对总Reducer取余
        return (Integer.parseInt(key.getAdcode()) + key.getYear() + key.getMonth()) % numPartitions;
    }

}